package com.lichengGongshang.util;

import java.io.*;

/**
 * Created by typ on 2015/5/21.
 */
public class FileUtil {
    public static void writeFile(InputStream inputStream, String savePath, String fileName) throws FileNotFoundException {
        byte b[] = new byte[1024];
        File file = new File(savePath + fileName);
        OutputStream fos = new FileOutputStream(file);
        try {
            int i = inputStream.read(b);
            while (i != -1) {
                fos.write(b,0,i);
                i = inputStream.read(b);
            }
            //System.out.print(str);
            inputStream.close();
            fos.flush();
            fos.close();

        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
